<template>
  <div class="box">
    <van-nav-bar
      fixed
      placeholder
      safe-area-inset-top
      title="注册手机号"
      @click-left="back"
    >
      <template #left>
        <van-icon name="arrow-left" size="16px" color="#333" />
      </template>
    </van-nav-bar>
    <div>
      <van-cell-group>
        <van-cell title="手机号" size="large" :value="tel" />
        <van-cell title="状态" size="large" :value="state" />
      </van-cell-group>
    </div>
  </div>
</template>

<script>
import { getUserInfo } from "../../apis/user.js";
import local from "../../utils/local.js";
import { getUserId } from "@/utils/auth";
export default {
  data() {
    return {
      tel: "",
      state: "未实名注册",
    };
  },
  created() {
    this.userId = getUserId() ? getUserId() : "";
    getUserInfo({ userId: this.userId }).then((res) => {
      local.set("userInfo", JSON.stringify(res.result));
      if (res.code == 201) {
        local.set("userInfo", JSON.stringify(res.result));
        this.tel = res.result.mobile;
        if (res.result.realNameAuthStatus == 1) {
          this.state = "实名注册";
        }
      }
    });
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
.box {
  height: 100%;
  background-color: #eee;
}
</style>